﻿Imports System.Net
Imports TNCBAL
Imports TNCDAL
Imports DevComponents
Imports Excel = Microsoft.Office.Interop.Excel
Public Class frmHBLOption
    Inherits DevComponents.DotNetBar.Office2007Form
    Private idHBL As Integer = -1
    'Private xlApp As Excel.Application = Nothing
    'Private printOK As Boolean = False
    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub
    Public Sub New(ByVal id As Integer)

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        idHBL = id
    End Sub
    Private Sub btPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btPrint.Click
        Dim textToPrint As String = ""
        If (radOriginal.Checked) Then
            textToPrint = "//ORIGINAL//"
        End If
        If (radSeaway.Checked) Then
            textToPrint = "//SEAWAY BILL//"
        End If
        If (radSurrender.Checked) Then
            textToPrint = "//SURRENDER//"
        End If
        Me.Hide()
        CViewer.PrintHBL_2(idHBL, textToPrint)
        Me.Close()
    End Sub

    'Private Sub frmHBLOption_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    '    If (printOK = False) Then
    '        'huỷ các đối tượng excel
    '        xlApp.Quit()
    '        releaseObject(xlApp)
    '    End If
    'End Sub
    Private Sub frmHBLOption_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        radNothing.Checked = True
    End Sub
    'Public Sub releaseObject(ByVal obj As Object)
    '    Try
    '        System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
    '        obj = Nothing
    '    Catch ex As Exception
    '        obj = Nothing
    '    Finally
    '        GC.Collect()
    '    End Try
    'End Sub
End Class